//
//  MerchantCell.m
//  UI_HLJ_Frame
//
//  Created by dllo on 15/7/1.
//  Copyright (c) 2015年 毕宏伟. All rights reserved.
//

#import "MerchantCell.h"
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation MerchantCell

- (void)dealloc
{
    [_merchantImageView release];
    [_merchantBackGroundView release];
    [_merchanrCase release];
    [_merchanrFans release];
    [_merchanrPackage release];
    [_merchantName release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.merchantBackGroundView = [[UIView alloc] init];
        [self.contentView addSubview:self.merchantBackGroundView];
        [self.merchantBackGroundView release];
        
        // 商家图片
        self.merchantImageView = [[UIImageView alloc] init];
        [self.merchantBackGroundView addSubview:self.merchantImageView];
        [self.merchantImageView release];
        
        // 商家名字
        self.merchantName = [[UILabel alloc] init];
        [self.merchantBackGroundView addSubview:self.merchantName];
        [self.merchantName release];
        
        // 套餐
        self.merchanrPackage = [[UILabel alloc] init];
        [self.merchantBackGroundView addSubview:self.merchanrPackage];
        [self.merchanrPackage release];
        
        // 案例
        self.merchanrCase = [[UILabel alloc] init];
        [self.merchantBackGroundView addSubview:self.merchanrCase];
        [self.merchanrCase release];
        
        // 粉丝数
        self.merchanrFans = [[UILabel alloc] init];
        [self.merchantBackGroundView addSubview:self.merchanrFans];
        [self.merchanrFans release];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    
    
    self.merchantBackGroundView.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    self.merchantBackGroundView.clipsToBounds = YES;
    
    self.merchantImageView.frame = CGRectMake(10, HEIGHT / 26, WIDTH/3, HEIGHT/1.09 );
    
    // 倒圆角
    self.merchantImageView.layer.cornerRadius = 10;
    // 切断倒下去的圆角
    self.merchantImageView.clipsToBounds = YES;
    //    self.merchantImageView.layer.cornerRadius = 10;
    
    // 商家名
    self.merchantName.frame = CGRectMake(WIDTH/2.59, 10, WIDTH / 3 * 1.6, HEIGHT/5*3);
    self.merchantName.font = [UIFont systemFontOfSize:17];
    // label上的文字自动换行
    self.merchantName.numberOfLines = 0;
//        self.merchantName.backgroundColor = [UIColor redColor];
    // 套餐
    self.merchanrPackage.frame = CGRectMake(WIDTH/2.59, HEIGHT/4*3, WIDTH/6, 20);
    self.merchanrPackage.font = [UIFont systemFontOfSize:12];
//        self.merchanrPackage.backgroundColor = [UIColor redColor];
    // 案例
    self.merchanrCase.frame = CGRectMake(WIDTH/1.72, HEIGHT/4*3, WIDTH/6, 20);
    self.merchanrCase.font = [UIFont systemFontOfSize:12];
//        self.merchanrCase.backgroundColor = [UIColor redColor];
    // 粉丝数
    self.merchanrFans.frame = CGRectMake(WIDTH/1.3, HEIGHT/4*3, WIDTH/4.84, 20);
    self.merchanrFans.font = [UIFont systemFontOfSize:12];
//        self.merchanrFans.backgroundColor = [UIColor redColor];
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
